class BaseModel {
	constructor(data, message) {
		if(typeof data === 'string') {
			this.message = data;
			data = null;
			message = null;
		}
		
		if(data) {
			this.data = data;
		}
		
		if(message) {
			this.message = message;
		}
	}
}

// 成功模型
class SuccessModel extends BaseModel {
	constructor(data, message) {
		super(data, message);
		this.code = 200;
	}
}

// 失败模型
class ErrorModel extends BaseModel {
	constructor(data, message) {
		super(data, message);
		this.code = 403;
	}
}

// 鉴权不通过
class AuthErrorModel extends BaseModel {
	constructor(data, message) {
		super("未登录", message);
		this.code = 401;
	}
}

module.exports = {
	SuccessModel,
	ErrorModel,
	AuthErrorModel
}